<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset={LANG_CHARSET}">
<title>{SITE_TITLE} - {PAGE_TITLE}</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link href="{SITE_URL}templates/{TPL_NAME}/images/styles.css" type="text/css" rel="stylesheet">
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="{SITE_URL}xmlfeeds.php?cmd=popular" />
<script language="JavaScript" type="text/JavaScript">
<!--
var http = createRequestObject();

function createRequestObject() 
{
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer")
	{
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		ro = new XMLHttpRequest();
	}
	return ro;
}

function digResponse() 
{
	if(http.readyState == 4)
	{
        var response = http.responseText;
		
		returned = response.split('|');

		if(response.indexOf('|' != -1)) 
		{
			var id=returned[1];
			var numdigs=returned[2];
			var status=returned[0];
			
			if(status == '1')
			{
				document.getElementById('digbut'+id).innerHTML = '{LANG_DUGG}';
				document.getElementById('numdigs'+id).innerHTML = numdigs;
  			}
			else if(status == '2')
			{
				document.getElementById('digbut'+id).innerHTML = '{LANG_DUGG}';
			}
			else if(status == '0')
			{
				document.getElementById('digbut'+id).innerHTML = '<a href="{SITE_URL}login.php">{LANG_LOGIN}<\/a>';
			}
		}
    }
}

function cdigResponse() 
{
	if(http.readyState == 4)
	{
        var response = http.responseText;
		
		returned = response.split('|');

		if(response.indexOf('|' != -1)) 
		{
			var id=returned[1];
			var numdigs=returned[2];
			var status=returned[0];
			
			if(status == '1')
			{
				document.getElementById('comd'+id).innerHTML = numdigs+' {LANG_DIGGS}';
				document.getElementById('cup'+id).className = 'opacityit';
				document.getElementById('cdown'+id).className = 'opacityit';
  			}
			else if(status == '2')
			{
				// Already dug comment
				document.getElementById('cup'+id).className = 'opacityit';
				document.getElementById('cdown'+id).className = 'opacityit';
			}
			else if(status == '0')
			{
				document.getElementById('comd'+id).innerHTML = '<a href="{SITE_URL}login.php">{LANG_LOGIN}<\/a>';
			}
		}
    }
}

function buryResponse() 
{
	if(http.readyState == 4)
	{
        var response = http.responseText;
		
		returned = response.split('|');

		if(response.indexOf('|' != -1)) 
		{
			var id=returned[1];
			var status=returned[0];
			
			if(status == '0')
			{
				document.getElementById('digbut'+id).innerHTML = '<a href="{SITE_URL}login.php">{LANG_LOGIN}<\/a>';
			}
			else
			{
				document.getElementById('digbut'+id).innerHTML = '{LANG_BURIED}';
			}
		}
	}
}

function dig(id)
{
	document.getElementById('digbut'+id).innerHTML = '{LANG_SENDING}';

	http.open('get', '{SITE_URL}dig.php?i='+id);
    http.onreadystatechange = digResponse;
    http.send(null);
}

function digcom(comment_id,dir,story_id)
{
	http.open('get', '{SITE_URL}dig.php?type=comm&i='+comment_id+'&story='+story_id+'&dir='+dir);
    http.onreadystatechange = cdigResponse;
    http.send(null);

	if(dir == 0)
	{
		dispcomment(comment_id,false,0);
	}
}

function bury_story(id)
{	
	if({LOGGEDIN} == 0)
	{
		document.getElementById('digbut'+id).innerHTML = '<a href="{SITE_URL}login.php">{LANG_LOGIN}<\/a>';
		return;
	}

	http.open('get', '{SITE_URL}bury.php?i='+id);
    http.onreadystatechange = buryResponse;
    http.send(null);
}

function inclickcheck(field,def,val)
{
	if(field.value == def)
	{
		field.value = val;
	}
}

function changeuser(field,but)
{
	if(field.value == '')
	{
		document.getElementById(but).disabled = true;
	}
	else
	{
		document.getElementById(but).disabled = false;
	}
}

function checkavail(field)
{
	username = document.getElementById(field).value;
	
	if(username.length < 4)
	{
		document.getElementById('availres').innerHTML = '{LANG_THEUSER} "'+username+'" {LANG_TOOSHORT}';
		return;
	}
	else if(username.length > 16)
	{
		document.getElementById('availres').innerHTML = '{LANG_THEUSER} "'+username+'" {LANG_TOOLONG}';
		return;
	}
	
	http.open('get', '{SITE_URL}signup.php?avail='+username);
    http.onreadystatechange = availResponse;
    http.send(null);
}

function availResponse() 
{
	if(http.readyState == 4)
	{
        var response = http.responseText;
		
		returned = response.split('|');

		if(response.indexOf('|' != -1)) 
		{
			var username=returned[0];
			var status=returned[1];

			if(status == 1)
			{
				document.getElementById('availres').innerHTML = '{LANG_THEUSER} "'+username+'" {LANG_ISAVAIL}';
			}
			else
			{
				document.getElementById('availres').innerHTML = '{LANG_SORRY}, {LANG_THEUSER} "'+username+'" {LANG_ISTAK}';
			}
		}
	}
}

function dispcomment(id,show,ctype)
{	
	if(ctype == 0)
	{
		if(show)
		{
			document.getElementById('commdesc'+id).style.display = '';
			document.getElementById('commbut'+id).innerHTML = '{LANG_BURIED} [<a href="javascript:dispcomment('+id+',false,0);">{LANG_HIDEC}</a>]';
		}
		else
		{
			document.getElementById('commdesc'+id).style.display = 'none';
			document.getElementById('commbut'+id).innerHTML = '{LANG_BURIED} [<a href="javascript:dispcomment('+id+',true,0);">{LANG_SHOWC}</a>]';
		}
	}
	else if(ctype == 1)
	{
		if(show)
		{
			document.getElementById('commdesc'+id).style.display = '';
			document.getElementById('commbut'+id).innerHTML = '{LANG_BELOWTHRESH} [<a href="javascript:dispcomment('+id+',false,1);">{LANG_HIDEC}</a>]';
		}
		else
		{
			document.getElementById('commdesc'+id).style.display = 'none';
			document.getElementById('commbut'+id).innerHTML = '{LANG_BELOWTHRESH} [<a href="javascript:dispcomment('+id+',true,1);">{LANG_SHOWC}</a>]';
		}
	}
}

function openWindow(theURL,winName,features) 
{
	window.open(theURL,winName,features);
}

function comreply(id,nickname)
{
	if({LOGGEDIN} == 0)
	{
		alert('Please login before replying');
		return;
	}

	document.getElementById('creply').style.display = '';
	document.getElementById('replynick').innerHTML = nickname;
	document.getElementById('parentid').value = id;
}

function replycancel()
{
	document.getElementById('creply').style.display = 'none';
	document.getElementById('replynick').innerHTML = '';
	document.getElementById('parentid').value = '0';
}
//-->
</script>
</head>

<body>
	<div id="headermain">
		<div id="headercontainer">
			<div class="headerlogo">
            	<div class="logo">
					<a href="{SITE_URL}" class="logo">{SITE_TITLE}</a>
                </div>
            </div>
			<div class="headeright">
                <div class="headerrighttop">
                    <div align="right">
						IF("{LOGGED_IN}"=="0"){
                        <div class="headersignupouter">
							<div class="headersignupicon"><a href="{SITE_URL}signup.php"></a></div>
							<div class="headersignuptext"><a href="{SITE_URL}signup.php">{LANG_SIGNUP}</a></div>
							<div class="aclear"></div> 
						</div> 
						<div class="headerloginouter">
							<div class="headerloginicon"><a href="{SITE_URL}login.php"></a></div>
							<div class="headerlogintext"><a href="{SITE_URL}login.php">{LANG_LOGIN}</a></div>
							<div class="aclear"></div> 
						</div>
                        {:IF}
						IF("{LOGGED_IN}"=="1"){
						<div class="headereditprofouter">
							<div class="headerloginicon"><a href="{SITE_URL}editprofile.php"></a></div>
							<div class="headereditproftext"><a href="{SITE_URL}editprofile.php">{LANG_EDITPROFILE}</a></div>
							<div class="aclear"></div> 
						</div>
						<div class="headerlogoutouter">
							<div class="headerloginicon"><a href="{SITE_URL}logout.php"></a></div>
							<div class="headerlogintext"><a href="{SITE_URL}logout.php">{LANG_LOGOUT}</a></div>
							<div class="aclear"></div> 
						</div>
						{:IF}
                    </div>
                </div>
				<div class="headerrightbottom">
					<div align="right">
                    	<form name="form1" method="get" action="{SITE_URL}search.php" style="padding:0px;margin:0px;">
						<div class="searchbox">
                        	<input name="q" type="text" id="q" size="25" style="width:250px;" />
						</div>
						<div class="searchbutton">
							<input name="submit" type="image" src="{SITE_URL}templates/{TPL_NAME}/images/search.gif" width="78" height="34" align="absmiddle" vspace="0" hspace="0" style="padding:0px;margin:0px;" border="0">
						</div>
                        </form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div id="navbar">
		<div id="navbarcontainer">
			<div id="topnav">
                <ul>
                	{LOOP: CATS_MAIN}
                   	<li><a title="{CATS_MAIN.cat_title}" href="{CATS_MAIN.cat_url}">{CATS_MAIN.cat_title}</a></li>
                    {/LOOP: CATS_MAIN}
                </ul>
			</div>
		</div>
	</div>
    IF("{SUBCAT_COUNT}"!="0"){
    <div id="navbar_sub">
        <div id="navbarcontainer_sub">
            <div id="subnav">
                <ul>
                	{LOOP: CATS_CUR}
                    <li><a title="{CATS_CUR.cat_title}" href="{CATS_CUR.cat_url}">{CATS_CUR.cat_title}</a></li>
                    {/LOOP: CATS_CUR}
                </ul>
            </div>
        </div>
    </div>
    {:IF}